﻿using App10.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace App10.Converters
{
    class PropertyConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var dict = value as Dictionary<string, IProperty>;
            var key = parameter.ToString();
            if (dict.ContainsKey(key))
            {
                var x = dict[parameter.ToString()] as IProperty;
                return (IProperty)x;
            }
            throw new KeyNotFoundException(key);
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
